home *** CD-ROM | disk | FTP | other *** search
- /* AWK_MAIN.C -- Expression tree constructors and main program for g/hawk.
- */
-
- /* Copyright © 1986, 1988, 1989 1991 the Free Software Foundation, Inc.
- * This file is part of GAWK, the GNU implementation of the
- * AWK Progamming Language, modified for the Macintosh (also called hAWK).
- * GAWK is free software; you can redistribute or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 1, or any later version.
- * GAWK is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with GAWK; see the file "COPYING hAWK". If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
- * Modified for THINK C 4 on the Macintosh by Ken Earle (Dynabyte) Aug 1991.
- * Entirely revised to compile under CodeWarrior 6.1 sometime before Aug 95.
- */
-
- #include "AWK.H"
- #include "AppCodeComm.h"
- #include "PATCHLEV.H" /* just defines PATCHLEVEL == 10 */
- #include <signal.h>
-
- extern short yyparse(void);
- extern void do_input(void);
- extern short close_io(void);
- extern void init_fields(void);
- extern short getopt(short argc, char **argv, char *opts);
- extern short re_set_syntax(short syntax);
- extern NODE *node(NODE *left, NODETYPE op, NODE *right);
-
- short AWKmain(short argc, char **argv);
- static void usage(void);
- static void set_fs(char *str);
- static void init_vars(void);
- static void init_args(short argc0, short argc, char *argv0, char **argv);
- static void MakeOutAsInName(void);
- static NODE *spc_var(char *name, NODE *value);
- static void pre_assign(char *v);
- static void copyleft(void);
- SIGTYPE catchsig(int sig);
-
- /* These nodes store all the special variables AWK uses */
- NODE *FS_node, *NF_node, *RS_node, *NR_node;
- NODE *FILENAME_node, *OFS_node, *ORS_node, *OFMT_node;
- NODE *FNR_node, *RLENGTH_node, *RSTART_node, *SUBSEP_node;
- NODE *ENVIRON_node, *IGNORECASE_node;
- NODE *ARGC_node, *ARGV_node; /* used primarily to hold the "leftover"
- file names to be used for input during program execution. See nextfile(). */
- NODE *RUNERR_node; /* Holds name of file to use for user error messages */
- NODE *STDPATH_node; /* Holds path to use as prefix for files to be written to
- same folder as stdout - typ looks like "Disk:folder1:...:folderN: */
- NODE /* *DAY_node, *DATE_node, */ *TIME_node; /* day, date, time (work in progress) */
- /*
- * The parse tree and field nodes are stored here. Parse_end is a dummy
- item used to free up unneeded fields without freeing the program being
- run . NOTE can't find "Parse_end" anywhere. */
- short errcount = 0; /* error counter, used by yyerror() */
-
- /* The global null string */
- NODE *Nnull_string;
-
- /* The name the program was invoked under, for error messages */
- char *myname;
-
- /* A block of AWK code to be run before running the program */
- NODE *begin_block = 0;
-
- /* A block of AWK code to be run after the last input file */
- NODE *end_block = 0;
-
- NODE *expression_value; /* The block of AWK code that IS the program */
-
- short exiting = 0; /* Was an "exit" statement executed? */
- short exit_val = 0; /* optional exit value */
-
- #ifdef DEBUG
- /* non-zero means in debugging is enabled. Probably not very useful */
- /* NOTE DEBUG is not yet supported in the Mac version. */
- short debugging = 0;
- extern short yydebug;
- #endif
-
- short tempsource = 0; /* source is in a temp file */
- char **sourcefile = NULL; /* source file name(s) -see sourcefileNote */
- short numfiles = -1; /* how many source files */
-
- #define STRICT /* keep it simple at first */
- short strict = 0; /* set to 1 below */
- /* NOTE ignoring the case while comparing strings and matching regular
- expressions is now allowed even if strict is nonzero, since it seems
- like a useful thing */
- short output_is_tty = 0; /* control flushing of output */
-
- char *stdOutAsInFileName = NULL; /* Holds stdout when used as input */
-
- /*
- * for strict to work, legal options must be first
- *
- * Unfortunately, -a and -e are orthogonal to -c.
- */
- #define EXTENSIONS 8 /* where to clear */
- #ifdef DEBUG
- char awk_opts[14] /*= "F:f:v:caeCVdD"*/;
- /* colon means preceding option takes an argument */
- #else
- char awk_opts[12] /*= "F:f:v:caeCV"*/;
- #endif
-
- /* Init functions, mainly since code resources are unhappy about
- initializing globals to an address. */
- void InitCommonsInAwkH(void); /* at bottom here */
- extern void InitAwkTabVars(void);
- extern void InitGetOpt(void);
- extern void InitEval(void);
- extern void InitField(void);
- extern void InitIO(void);
- extern void InitNode(void);
- extern void InitRegex(void);
- extern void InitRandom(void);
-
- /* Revision: redirect stdout/err to text files, at end close them and
- free up all allocated memory. This function is largely unchanged for the
- Mac version, since hAWK_Interface.c creates a command line based on
- user mouse-waves. */
- short AWKmain(short argc, char **argv)
- {
- #ifdef DEBUG
- /* Print out the parse tree. For debugging */
- register short dotree = 0;
- #endif
- extern char *version_string; /* see VERSION.c */
- FILE *fp, *textstdout, textstderr;
- short c;
- extern short opterr, optind;
- extern char *optarg;
- extern char *strrchr(); /* <string.h> */
- extern char *tmpnam(); /* <stdio.h> */
- short i;
- short nostalgia;
- #ifdef somtime_in_the_future
- short regex_mode = RE_SYNTAX_POSIX_EGREP;
- #else
- short regex_mode = RE_SYNTAX_AWK;
- #endif
-
- extern Boolean gConcurrent;
-
- /* initialize variables */
- InitCommonsInAwkH();
- InitAwkTabVars();
- InitGetOpt();
- InitEval();
- InitField();
- InitIO();
- InitNode();
- InitRegex();
- if (!hAWKstackDepth)
- InitRandom();
-
- if (!hAWKstackDepth)
- {
- if (strncmp(version_string, "@(#)", 4) == 0)
- version_string += 4;
-
- (void) signal(SIGFPE, catchsig); /* <signal.h> div by zero etc */
-
- /* redirect stderr to text file. stdout is reopened in
- init_args - postponed because reopening it now would
- zero it out, and user may want to take input from
- stdout (ie the results of the last Drag_on Module run. */
- if (!freopen(gacc.stdErrFileName, "w", stderr))
- /* fatal error */
- exit(1);
- }
-
- /* Pick out "AWK" or somesuch from first argument */
- myname = strrchr(argv[0], '/');
- if (myname == NULL)
- myname = argv[0]; /* typical case, since not using '/' */
- else
- myname++;
- if (argc < 2)
- usage();
-
- /* initialize the null string */
- Nnull_string = make_string("", 0);
- Nnull_string->numbr = 0.0;
- Nnull_string->type = Node_val;
- Nnull_string->flags = (PERM|STR|NUM|NUMERIC);
-
- /* Set up the special variables */
-
- /*
- * Note that this must be done BEFORE arg parsing else -F
- * breaks horribly
- */
- init_vars();
-
-
-
- /* worst case */
- emalloc(sourcefile, char **, argc * sizeof(char *), "main");
-
- #ifdef STRICT /* strict new awk compatibility */
- strict = 1;
- awk_opts[EXTENSIONS] = '\0';
- #endif
-
- #ifndef STRICT
- /* undocumented feature, inspired by nostalgia, and a T-shirt */
- nostalgia = 0;
- for (i = 1; i < argc && argv[i][0] == '-'; i++) {
- if (argv[i][1] == '-') /* -- */
- break;
- else if (argv[i][1] == 'c') { /* compatibility mode */
- nostalgia = 0;
- break;
- } else if (STREQ(&argv[i][1], "nostalgia"))
- nostalgia = 1;
- /* keep looping, in case -c after -nostalgia */
- }
- if (nostalgia) {
- fprintf (stderr, "awk: bailing out near line 1\n");
- abort();
- }
- #endif
-
- /* AWK options: see AWKOptionsNote */
- while ((c = getopt (argc, argv, awk_opts)) != EOF) {
- switch (c) {
- /* Note '--' is detected by getopt() */
- #ifdef DEBUG
- case 'd':
- debugging++;
- dotree++;
- break;
-
- case 'D':
- debugging++;
- yydebug = 2;
- break;
- #endif
-
- #ifndef STRICT
- case 'c':
- strict = 1;
- break;
- #endif
-
- case 'F':
- set_fs(optarg);
- break;
-
- case 'f':
- /*
- * a la MKS awk, allow multiple -f options.
- * this makes function libraries real easy.
- * most of the magic is in the scanner.
- NOTE each source file to be preceded by '-f' */
-
- /* REVISION RecordSourceFile() */
- sourcefile[++numfiles] = optarg;
- break;
-
- case 'v':
- pre_assign(optarg);
- break;
-
- case 'V':
- fprintf(stderr, "%s, patchlevel %d\n",
- version_string, PATCHLEVEL);
- break;
-
- case 'C':
- copyleft();
- break;
-
- case 'a': /* use old fashioned awk regexps */
- regex_mode = RE_SYNTAX_AWK;
- break;
-
- case 'e': /* use egrep style regexps, per Posix */
- regex_mode = RE_SYNTAX_POSIX_EGREP;
- break;
-
- case '?':
- default:
- /* getopt will print a message for us */
- /* S5R4 awk ignores bad options and keeps going */
- break;
- }
- }
-
- /* Tell the regex routines how they should work. . . */
- (void) re_set_syntax(regex_mode);
-
- #ifdef DEBUG
- setbuf(stdout, (char *) NULL); /* make debugging easier */
- #endif
- // if (isatty(fileno(stdout)))
- // output_is_tty = 1;
- /* No -f option, use next arg */
- /* write to temp file and save sourcefile name */
- if (numfiles == -1) {
- short i;
-
- if (optind > argc - 1) /* no args left */
- usage();
- numfiles++;
- i = strlen (argv[optind]);
- if (i == 0) { /* sanity check */
- fprintf(stderr, "%s: empty program text\n", myname);
- usage();
- /* NOTREACHED */
- }
- sourcefile[0] = tmpnam((char *) NULL);
- if ((fp = fopen (sourcefile[0], "w")) == NULL)
- fatal("could not save source prog in temp file (%s)",
- strerror(errno));
- if (fwrite (argv[optind], 1, i, fp) == 0)
- fatal(
- "could not write source program to temp file (%s)",
- strerror(errno));
- if (argv[optind][i-1] != '\n')
- putc ('\n', fp);
- (void) fclose (fp);
- tempsource++;
- optind++;
- }
- /* This builds list of input files to ARGVnode */
- init_args(optind, argc, myname, argv);
-
- errcount = 0;
- if (!gConcurrent)
- CheckForInterrupt();
-
- /* Read in the program */
- if (yyparse() || errcount)
- exit(1);
- if (!gConcurrent)
- CheckForInterrupt();
- #ifdef DEBUG
- if (dotree)
- print_parse_tree(expression_value);
- #endif
- /* Set up the field variables */
- init_fields();
-
- if (begin_block)
- (void) interpret(begin_block);
- if (gConcurrent)
- {
- if (CheckInWithCallingApp()) /* CodeResource_Helper.c */
- JumpOnHAWKError(999);
- }
- else
- CheckForInterrupt();
- if (!exiting && (expression_value || end_block))
- do_input();
- if (!gConcurrent)
- CheckForInterrupt();
- if (end_block)
- (void) interpret(end_block);
- if (close_io() != 0 && exit_val == 0)
- exit_val = 1;
-
- /* REACHED */
- return exit_val;
- }
-
- static void
- usage()
- {
- char *opt1 = " -f progfile [--]";
- char *opt2 = " [--] 'program'";
- #ifdef STRICT
- char *regops = " [-ae] [-F fs] [-v var=val]";
- #else
- char *regops = " [-aecCV] [-F fs] [-v var=val]";
- #endif
-
- fprintf(stderr, "usage: %s%s%s file ...\n %s%s%s file ...\n",
- myname, regops, opt1, myname, regops, opt2);
- exit(11);
- }
-
- /* Generate compiled regular expressions */
- struct re_pattern_buffer *
- make_regexp(NODE *s, short ignorecase)
- {
- struct re_pattern_buffer *rp;
- char *err;
-
- emalloc(rp, struct re_pattern_buffer *, sizeof(*rp), "make_regexp");
- memset((char *) rp, 0, sizeof(*rp));
- emalloc(rp->buffer, char *, 16, "make_regexp");
- rp->allocated = 16;
- emalloc(rp->fastmap, char *, 256, "make_regexp");
-
- if (/*! strict && */ ignorecase)
- rp->translate = casetable;
- else
- rp->translate = NULL;
- if ((err = re_compile_pattern(s->stptr, s->stlen, rp)) != NULL)
- fatal("%s: /%s/", err, s->stptr);
- free_temp(s);
- return rp;
- }
-
- struct re_pattern_buffer *
- mk_re_parse(char *s, short ignorecase)
- {
- char *src;
- register char *dest;
- register short c;
- short in_brack = 0;
-
- for (dest = src = s; *src != '\0';) {
- if (*src == '\\') {
- c = *++src;
- switch (c) {
- case '/':
- case 'a':
- /*case 'b':*/
- case 'f':
- case 'n':
- case 'r':
- case 't':
- case 'v':
- case 'x':
- case '0':
- c = parse_escape(&src);
- if (c < 0)
- cant_happen();
- *dest++ = (char)c;
- break;
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- if (*(src+1) >= '0' && *(src+1) <= '7')
- {
- c = parse_escape(&src);
- if (c < 0)
- cant_happen();
- *dest++ = (char)c;
- }
- else
- {
- *dest++ = '\\';
- *dest++ = (char)c;
- src++;
- }
- break;
- default:
- *dest++ = '\\';
- *dest++ = (char)c;
- src++;
- break;
- }
- } else if (*src == '/' && ! in_brack)
- break;
- else {
- if (*src == '[')
- in_brack = 1;
- else if (*src == ']')
- in_brack = 0;
-
- *dest++ = *src++;
- }
- }
- return make_regexp(tmp_string(s, (short)(dest-s)), ignorecase);
- }
-
- /* This replaced by "About" button in main dialog. */
- static void
- copyleft ()
- {
- extern char *version_string;
- char *cp;
- static char blurb[] =
- "Copyright (C) 1989, Free Software Foundation.\n\
- GNU Awk comes with ABSOLUTELY NO WARRANTY. This is free software, and\n\
- you are welcome to distribute it under the terms of the GNU General\n\
- Public License, which covers both the warranty information and the\n\
- terms for redistribution.\n\n\
- You should have received a copy of the GNU General Public License along\n\
- with this program; if not, write to the Free Software Foundation, Inc.,\n\
- 675 Mass Ave, Cambridge, MA 02139, USA.\n";
-
- fprintf (stderr, "%s, patchlevel %d\n", version_string, PATCHLEVEL);
- fputs(blurb, stderr);
- fflush(stderr);
- }
-
- static void
- set_fs(char *str)
- {
- register NODE **tmp;
-
- tmp = get_lhs(FS_node, 0);
- /*
- * Only if in full compatibility mode check for the stupid special
- * case so -F\t works as documented in awk even though the shell
- * hands us -Ft. Bleah!
- */
- if (strict && str[0] == 't' && str[1] == '\0')
- str[0] = '\t';
- *tmp = make_string(str, 1);
- do_deref();
- }
-
- static void
- init_args(short argc0, short argc, char *argv0, char **argv)
- {
- short i, j;
- NODE **aptr;
- Boolean stdOutReset = FALSE;
-
- ARGV_node = spc_var("ARGV", Nnull_string);
- aptr = assoc_lookup(ARGV_node, tmp_number(0.0));
- *aptr = make_string(argv0, strlen(argv0));
- for (i = argc0, j = 1; i < argc; i++)
- {
- /* Allow stdout from last run to be used as input for this
- run; since stdout is overwritten, first save its contents under
- a new name. This quietly changes the name of stdout stored in
- ARGV[] which would throw off redirection, but normally one does
- not both take input from stdout and redirect output to one of the
- input files. */
- if (!strcmp(argv[i], gacc.stdOutFileName))
- {
- if (stdOutAsInFileName == NULL)
- MakeOutAsInName();
- fclose(stdout);/* ignore error if not open */
- remove(stdOutAsInFileName); /* ignore error if doesn't exist */
- rename(gacc.stdOutFileName, stdOutAsInFileName);/* fails if stdout not there... */
- stdOutReset = TRUE;
- aptr = assoc_lookup(ARGV_node, tmp_number((AWKNUM) j));
- *aptr = make_string(stdOutAsInFileName, strlen(stdOutAsInFileName));
- }
- else
- {
- aptr = assoc_lookup(ARGV_node, tmp_number((AWKNUM) j));
- *aptr = make_string(argv[i], strlen(argv[i]));
- }
- j++;
- }
- ARGC_node = spc_var("ARGC", make_number((AWKNUM) j));
-
- /* stdout is finally safe to (re)open */
- if (!hAWKstackDepth || stdOutReset)
- {
- if (!freopen(gacc.stdOutFileName, "w", stdout))
- /* fatal error */
- exit(1);
- }
- }
-
- /* Set global stdOutAsInFileName to temp file name to use for
- stdout file which will be used for current input.
- Typ stdOutAsInFileName = "Disk:...:THINK C folder:$tempOutAsInput" */
- static void MakeOutAsInName()
- {
- char *var;
- short i;
-
- var = gacc.stdOutFileName;
- i = strlen(gacc.stdOutFileName);
- while (*(var + i - 1) != ':' && i > 0)
- --i;
- /* note the trailing colon is kept */
- emalloc(stdOutAsInFileName, char *, i+16, "init_args");
- BlockMove(gacc.stdOutFileName, stdOutAsInFileName, i);
- BlockMove("$tempOutAsInput", stdOutAsInFileName+i, 16);
- }
-
- /*
- * Set all the special variables to their initial values.
- ENVIRION not done for the Mac version.
- */
- static void
- init_vars()
- {
- #ifndef MACVERSION
- extern char **environ;
- #endif
- char *var, *val, temp[3];
- NODE **aptr;
- time_t now;
- struct tm *date;
- char s[50];
- short i;
-
- FS_node = spc_var("FS", make_string(" ", 1));
- NF_node = spc_var("NF", make_number(-1.0));
- RS_node = spc_var("RS", make_string("\n", 1));
- NR_node = spc_var("NR", make_number(0.0));
- FNR_node = spc_var("FNR", make_number(0.0));
- FILENAME_node = spc_var("FILENAME", make_string("-", 1));
- OFS_node = spc_var("OFS", make_string(" ", 1));
- ORS_node = spc_var("ORS", make_string("\n", 1));
- OFMT_node = spc_var("OFMT", make_string("%.6g", 4));
- RLENGTH_node = spc_var("RLENGTH", make_number(0.0));
- RSTART_node = spc_var("RSTART", make_number(0.0));
- SUBSEP_node = spc_var("SUBSEP", make_string("\034", 1));
- IGNORECASE_node = spc_var("IGNORECASE", make_number(0.0));
-
- ENVIRON_node = spc_var("ENVIRON", Nnull_string);
- #ifdef MACVERSION
- /* the stdErrFileName is $tempStdErr, whereas the RUNERR file name is
- $tempRunErr. */
- var = gacc.stdErrFileName;
- i = strlen(gacc.stdErrFileName);
- if (i >= 6)
- {
- temp[0] = var[i-6];
- var[i-6] = 'R';
- temp[1] = var[i-5];
- var[i-5] = 'u';
- temp[2] = var[i-4];
- var[i-4] = 'n';
- RUNERR_node = spc_var("RUNERR", make_string(gacc.stdErrFileName, i));
- var[i-6] = temp[0];
- var[i-5] = temp[1];
- var[i-4] = temp[2];
- }
- /* STDPATH holds path name to be used as prefix for any file that is to be
- written to the same folder as stdout. */
- while (*(var + i - 1) != ':' && i > 0)
- --i;
- /* note the trailing colon is kept */
- STDPATH_node = spc_var("STDPATH", make_string(gacc.stdErrFileName, i));
-
- /* Date/time */
- now = time(NULL);
- date = localtime(&now);
- i = strftime(s,50, "%A, %B %d, %Y %I:%M %p", date);
- TIME_node = spc_var("TIME", make_string(s, i));
- /* work in progress ****************
- i = strftime(s,50, "%A", date);
- DAY_node = spc_var("DAY", make_string(s, i));
- i = strftime(s,50, "%B %d, %Y", date);
- DATE_node = spc_var("DATE", make_string(s, i));
- i = strftime(s,50, "%I:%M:%S %p", date);
- TIME_node = spc_var("TIME", make_string(s, i));
- *********/
-
- return;
-
- #else
- for (i = 0; environ[i]; i++) {
- static char nullstr[] = "";
-
- var = environ[i];
- val = strchr(var, '=');
- if (val)
- *val++ = '\0';
- else
- val = nullstr;
- aptr = assoc_lookup(ENVIRON_node, tmp_string(var, strlen (var)));
- *aptr = make_string(val, strlen (val));
-
- /* restore '=' so that system() gets a valid environment */
- if (val != nullstr)
- *--val = '=';
- }
- #endif
- }
-
- /* Create a special variable */
- static NODE *
- spc_var(char *name, NODE *value)
- {
- register NODE *r;
-
- if ((r = lookup(variables, name)) == NULL)
- r = install(variables, name, node(value, Node_var, (NODE *) NULL));
- return r;
- }
-
- static void
- pre_assign(char *v)
- {
- char *cp;
-
- cp = strchr(v, '=');
- if (cp != NULL) {
- *cp++ = '\0';
- variable(v)->var_value = make_string(cp, strlen(cp));
- } else {
- fprintf (stderr,
- "%s: '%s' argument to -v not in 'var=value' form\n",
- myname, v);
- usage();
- }
- }
-
-
- SIGTYPE catchsig(int sig)
- {
- extern void msg(char *va_alist, ...);
-
- if (sig == SIGFPE) {
- fatal("floating point exception");
- } else if (sig == SIGSEGV) {
- msg("fatal error: segmentation fault");
- /* fatal won't abort() if not compiled for debugging */
- abort();
- } else
- cant_happen();
- /* NOTREACHED */
- }
-
- void InitCommonsInAwkH()
- {
- extern char *version_string; /* see VERSION.c */
- version_string = "@(#)Gnu Awk (gawk) 2.11.1";
-
- if (!hAWKstackDepth)
- {
- #ifdef DEBUG
- strcpy(awk_opts, "F:f:v:caeCVdD");
- /* colon means preceding option takes an argument */
- #else
- strcpy(awk_opts, "F:f:v:caeCV");
- #endif
- }
- exiting = 0; /* Was an "exit" statement executed? */
- exit_val = 0; /* optional exit value */
- tempsource = 0; /* source is in a temp file */
- sourcefile = NULL; /* source file name(s) -see sourcefileNote */
- numfiles = -1; /* how many source files */
- output_is_tty = 0; /* control flushing of output */
- /* gawk builtin variables */
- FS_node = NF_node = RS_node = NR_node = NULL;
- FILENAME_node = OFS_node = ORS_node = OFMT_node = NULL;
- FNR_node = RLENGTH_node = RSTART_node = SUBSEP_node = NULL;
- IGNORECASE_node = NULL;
-
- stack_ptr = NULL;
- Nnull_string = NULL;
- deref = NULL;
- fields_arr = NULL;
- sourceline = 0;
- source = NULL;
- expression_value = NULL;
- _t = NULL; /* used as temporary in tree_eval */
- myname = NULL;
- node0_valid = 1;
- }
-
- void SaveCommonsInAwkH(void);
- void RestoreCommonsInAwkH(void);
- void SaveCommonsInAwkH()
- {
- hs->exiting = exiting;
- hs->exit_val = exit_val;
- hs->tempsource = tempsource;
- hs->sourcefile = sourcefile;
- hs->numfiles = numfiles;
- hs->output_is_tty = output_is_tty;
- hs->FS_node = FS_node;
- hs->NF_node = NF_node;
- hs->RS_node = RS_node;
- hs->NR_node = NR_node;
- hs->FILENAME_node = FILENAME_node;
- hs->OFS_node = OFS_node;
- hs->ORS_node = ORS_node;
- hs->OFMT_node = OFMT_node;
- hs->FNR_node = FNR_node;
- hs->RLENGTH_node = RLENGTH_node;
- hs->RSTART_node = RSTART_node;
- hs->SUBSEP_node = SUBSEP_node;
- hs->IGNORECASE_node = IGNORECASE_node;
- hs->ARGC_node = ARGC_node;
- hs->ARGV_node = ARGV_node;
- hs->RUNERR_node = RUNERR_node;
- hs->STDPATH_node = STDPATH_node;
- hs->TIME_node = TIME_node;
- hs->stack_ptr = stack_ptr;
- hs->deref = deref;
- hs->fields_arr = fields_arr;
- hs->sourceline = sourceline;
- hs->source = source;
- hs->expression_value = expression_value;
- hs->_t = _t;
- hs->myname = myname;
- hs->node0_valid = node0_valid;
-
- }
-
- void RestoreCommonsInAwkH()
- {
- exiting = hs->exiting;
- exit_val = hs->exit_val;
- tempsource = hs->tempsource;
- sourcefile = hs->sourcefile;
- numfiles = hs->numfiles;
- output_is_tty = hs->output_is_tty;
- FS_node = hs->FS_node;
- NF_node = hs->NF_node;
- RS_node = hs->RS_node;
- NR_node = hs->NR_node;
- FILENAME_node = hs->FILENAME_node;
- OFS_node = hs->OFS_node;
- ORS_node = hs->ORS_node;
- OFMT_node = hs->OFMT_node;
- FNR_node = hs->FNR_node;
- RLENGTH_node = hs->RLENGTH_node;
- RSTART_node = hs->RSTART_node;
- SUBSEP_node = hs->SUBSEP_node;
- IGNORECASE_node = hs->IGNORECASE_node;
- ARGC_node = hs->ARGC_node;
- ARGV_node = hs->ARGV_node;
- RUNERR_node = hs->RUNERR_node;
- STDPATH_node = hs->STDPATH_node;
- TIME_node = hs->TIME_node;
- stack_ptr = hs->stack_ptr;
- deref = hs->deref;
- fields_arr = hs->fields_arr;
- sourceline = hs->sourceline;
- source = hs->source;
- expression_value = hs->expression_value;
- _t = hs->_t;
- myname = hs->myname;
- node0_valid = hs->node0_valid;
-
- }
-